package com.yjz.jvm.juc.Lock.ReentrantLockLearn;


public class IncreaseThread extends Thread {

    private Target target;

    public IncreaseThread(Target target,String name) {
        this.target = target;
        super.setName(name);
    }

    @Override
    public void run() {
        for (int i = 0; i < 30; i++) {
            try {
                Thread.sleep((long) Math.random() * 500);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            target.increase();
        }
    }
}
